package com.atguigu.tms.mock.service.impl;

import com.atguigu.tms.mock.bean.ATemplateCityDistance;
import com.atguigu.tms.mock.mapper.ATemplateCityDistanceMapper;
import com.atguigu.tms.mock.service.ATemplateCityDistanceService;
import com.atguigu.tms.mock.service.adv.impl.AdvServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhangchen
 * @since 2022-06-17
 */
@Service
public class ATemplateCityDistanceServiceImpl extends AdvServiceImpl<ATemplateCityDistanceMapper, ATemplateCityDistance> implements ATemplateCityDistanceService {



    public Set<Long> getEnabledCityId(){
        Map<Long, ATemplateCityDistance>  cityDistanceMap = super.all(true);

        Set<Long> cityIdSet=new HashSet<>();

        for (ATemplateCityDistance templateCityDistance : cityDistanceMap.values()) {

            cityIdSet.add(templateCityDistance.getCityNo1()) ;
            cityIdSet.add(templateCityDistance.getCityNo2()) ;

        }
        return  cityIdSet;


    }
}
